superstrict

import "SourceLine.bmx"

type Error

	'// -------------------------------------------------------------------------------------------------------------
	'// Message type constants.
	'// -------------------------------------------------------------------------------------------------------------
	const CUSTOM:short = 0;
	const UNTERMINATED_COMMENT:short = 1;
	const UNTERMINATED_BRACKET:short = 2;
	const INVALID_TOKEN:short = 3;
	const OPENING_BRACKET_MISSING:short = 4;
	const UNKNOWN_ESCAPE_SEQUENCE:short = 5;
	const EXPECTED:short = 6;
	const EXPECTED_A_BEFORE_B:short = 7;
	const A_NOT_DECLARED_IN_SCOPE:short = 8;
	
	'// -------------------------------------------------------------------------------------------------------------
	'// Create, setup and return a new error.
	'// -------------------------------------------------------------------------------------------------------------
	function createError:Error(_type:short, line:SourceLine, data:string)
	
		local e:Error = new Error;
		
		e.m_type = _type;
		e.m_data = data;
		e.m_line = line;
		
		return e;
	
	end function
	
	'// -------------------------------------------------------------------------------------------------------------
	'// Which error message type this error is using.
	'// -------------------------------------------------------------------------------------------------------------
	field m_type:short;
	
	'// -------------------------------------------------------------------------------------------------------------
	'// The data the error contains.
	'// -------------------------------------------------------------------------------------------------------------
	field m_data:string;
	
	'// -------------------------------------------------------------------------------------------------------------
	'// A pointer to the line where the error was found.
	'// -------------------------------------------------------------------------------------------------------------
	field m_line:SourceLine;

end type
